package com.five.zhh.fiveinfive.room.message.result;

import com.five.zhh.fiveinfive.room.message.OperateTittle;
import com.five.zhh.fiveinfive.room.message.UserOperateResult;
import com.five.zhh.fiveinfive.room.user.UserInfoInRoom;
import lombok.Getter;

/**
 * <p>
 * 描述
 * </p>
 *
 * @author 粥灰灰
 * <p>2025/2/4</p>
 */
@Getter
public class PlayChessResult extends UserOperateResult {
    private int x;
    private int y;
    private int color;
    private boolean success;

    private PlayChessResult(boolean success, int color, int y, int x, UserInfoInRoom receiver, String roomCode) {
        super(OperateTittle.PLAY_CHESS, roomCode);
        this.receiver = receiver;
        this.success = success;
        this.color = color;
        this.y = y;
        this.x = x;
    }

    private PlayChessResult(boolean success, int color, int y, int x, String reason, UserInfoInRoom receiver, String roomCode) {
        super(OperateTittle.PLAY_CHESS, roomCode);
        this.receiver = receiver;
        this.success = success;
        this.color = color;
        this.y = y;
        this.x = x;
        this.message = reason;
    }

    public static PlayChessResult success(int color, int x, int y, UserInfoInRoom receiver, String roomCode) {
        return new PlayChessResult(true, color, y, x, receiver, roomCode);
    }

    public static PlayChessResult fail(int color, int x, int y, String reason, UserInfoInRoom receiver, String roomCode) {
        return new PlayChessResult(false, color, y, x, reason, receiver, roomCode);
    }
}
